package org.base23.video.domain.dto;

import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/**
 * 优化的分析数据 - 只保存改善建议和时间段信息
 * 排除逐帧详细数据，专注于用户需要的指导信息
 */
public class OptimizedAnalysisData {
    
    /**
     * 基础视频信息（不包含逐帧数据）
     */
    @JsonProperty("videoSummary")
    private VideoSummary videoSummary;
    
    /**
     * 运动阶段改善信息
     */
    @JsonProperty("phaseImprovements")
    private List<PhaseImprovement> phaseImprovements;
    
    /**
     * 关节改善建议
     */
    @JsonProperty("jointImprovements")
    private List<JointImprovement> jointImprovements;
    
    /**
     * 个性化指导建议
     */
    @JsonProperty("personalizedCoaching")
    private DetailedPostureAnalysis.PersonalizedCoaching personalizedCoaching;
    
    /**
     * 训练计划
     */
    @JsonProperty("trainingPlan")
    private DetailedPostureAnalysis.TrainingPlan trainingPlan;
    
    /**
     * 整体评估
     */
    @JsonProperty("overallAssessment")
    private DetailedPostureAnalysis.OverallAssessment overallAssessment;
    
    /**
     * 生物力学分析（关键指标）
     */
    @JsonProperty("biomechanicsAnalysis")
    private DetailedPostureAnalysis.BiomechanicsAnalysis biomechanicsAnalysis;
    
    public OptimizedAnalysisData() {}
    
    // Getters and Setters
    public VideoSummary getVideoSummary() { return videoSummary; }
    public void setVideoSummary(VideoSummary videoSummary) { this.videoSummary = videoSummary; }
    
    public List<PhaseImprovement> getPhaseImprovements() { return phaseImprovements; }
    public void setPhaseImprovements(List<PhaseImprovement> phaseImprovements) { this.phaseImprovements = phaseImprovements; }
    
    public List<JointImprovement> getJointImprovements() { return jointImprovements; }
    public void setJointImprovements(List<JointImprovement> jointImprovements) { this.jointImprovements = jointImprovements; }
    
    public DetailedPostureAnalysis.PersonalizedCoaching getPersonalizedCoaching() { return personalizedCoaching; }
    public void setPersonalizedCoaching(DetailedPostureAnalysis.PersonalizedCoaching personalizedCoaching) { this.personalizedCoaching = personalizedCoaching; }
    
    public DetailedPostureAnalysis.TrainingPlan getTrainingPlan() { return trainingPlan; }
    public void setTrainingPlan(DetailedPostureAnalysis.TrainingPlan trainingPlan) { this.trainingPlan = trainingPlan; }
    
    public DetailedPostureAnalysis.OverallAssessment getOverallAssessment() { return overallAssessment; }
    public void setOverallAssessment(DetailedPostureAnalysis.OverallAssessment overallAssessment) { this.overallAssessment = overallAssessment; }
    
    public DetailedPostureAnalysis.BiomechanicsAnalysis getBiomechanicsAnalysis() { return biomechanicsAnalysis; }
    public void setBiomechanicsAnalysis(DetailedPostureAnalysis.BiomechanicsAnalysis biomechanicsAnalysis) { this.biomechanicsAnalysis = biomechanicsAnalysis; }
    
    /**
     * 视频摘要信息（基础信息，不包含逐帧数据）
     */
    public static class VideoSummary {
        @JsonProperty("fps")
        private Double fps;
        
        @JsonProperty("totalFrames")
        private Integer totalFrames;
        
        @JsonProperty("duration")
        private Double duration;
        
        @JsonProperty("resolution")
        private String resolution;
        
        public VideoSummary() {}
        
        public Double getFps() { return fps; }
        public void setFps(Double fps) { this.fps = fps; }
        public Integer getTotalFrames() { return totalFrames; }
        public void setTotalFrames(Integer totalFrames) { this.totalFrames = totalFrames; }
        public Double getDuration() { return duration; }
        public void setDuration(Double duration) { this.duration = duration; }
        public String getResolution() { return resolution; }
        public void setResolution(String resolution) { this.resolution = resolution; }
    }
    
    /**
     * 阶段改善信息 - 专注于时间段和改善建议
     */
    public static class PhaseImprovement {
        @JsonProperty("phaseName")
        private String phaseName;
        
        @JsonProperty("timeRange")
        private TimeRange timeRange;
        
        @JsonProperty("currentScore")
        private Double currentScore;
        
        @JsonProperty("targetScore")
        private Double targetScore;
        
        @JsonProperty("criticalPoints")
        private List<String> criticalPoints;
        
        @JsonProperty("improvementActions")
        private List<String> improvementActions;
        
        @JsonProperty("priority")
        private String priority; // HIGH, MEDIUM, LOW
        
        public PhaseImprovement() {}
        
        public String getPhaseName() { return phaseName; }
        public void setPhaseName(String phaseName) { this.phaseName = phaseName; }
        public TimeRange getTimeRange() { return timeRange; }
        public void setTimeRange(TimeRange timeRange) { this.timeRange = timeRange; }
        public Double getCurrentScore() { return currentScore; }
        public void setCurrentScore(Double currentScore) { this.currentScore = currentScore; }
        public Double getTargetScore() { return targetScore; }
        public void setTargetScore(Double targetScore) { this.targetScore = targetScore; }
        public List<String> getCriticalPoints() { return criticalPoints; }
        public void setCriticalPoints(List<String> criticalPoints) { this.criticalPoints = criticalPoints; }
        public List<String> getImprovementActions() { return improvementActions; }
        public void setImprovementActions(List<String> improvementActions) { this.improvementActions = improvementActions; }
        public String getPriority() { return priority; }
        public void setPriority(String priority) { this.priority = priority; }
    }
    
    /**
     * 关节改善信息
     */
    public static class JointImprovement {
        @JsonProperty("jointName")
        private String jointName;
        
        @JsonProperty("problemDescription")
        private String problemDescription;
        
        @JsonProperty("currentPerformance")
        private DetailedPostureAnalysis.JointPerformance currentPerformance;
        
        @JsonProperty("targetRange")
        private DetailedPostureAnalysis.AngleRange targetRange;
        
        @JsonProperty("specificAdvice")
        private List<String> specificAdvice;
        
        @JsonProperty("improvementTimeframe")
        private String improvementTimeframe;
        
        @JsonProperty("riskLevel")
        private String riskLevel; // LOW, MEDIUM, HIGH
        
        public JointImprovement() {}
        
        public String getJointName() { return jointName; }
        public void setJointName(String jointName) { this.jointName = jointName; }
        public String getProblemDescription() { return problemDescription; }
        public void setProblemDescription(String problemDescription) { this.problemDescription = problemDescription; }
        public DetailedPostureAnalysis.JointPerformance getCurrentPerformance() { return currentPerformance; }
        public void setCurrentPerformance(DetailedPostureAnalysis.JointPerformance currentPerformance) { this.currentPerformance = currentPerformance; }
        public DetailedPostureAnalysis.AngleRange getTargetRange() { return targetRange; }
        public void setTargetRange(DetailedPostureAnalysis.AngleRange targetRange) { this.targetRange = targetRange; }
        public List<String> getSpecificAdvice() { return specificAdvice; }
        public void setSpecificAdvice(List<String> specificAdvice) { this.specificAdvice = specificAdvice; }
        public String getImprovementTimeframe() { return improvementTimeframe; }
        public void setImprovementTimeframe(String improvementTimeframe) { this.improvementTimeframe = improvementTimeframe; }
        public String getRiskLevel() { return riskLevel; }
        public void setRiskLevel(String riskLevel) { this.riskLevel = riskLevel; }
    }
    
    /**
     * 时间范围（以秒为单位，更直观）
     */
    public static class TimeRange {
        @JsonProperty("startTime")
        private Double startTime; // 开始时间（秒）
        
        @JsonProperty("endTime")
        private Double endTime; // 结束时间（秒）
        
        @JsonProperty("duration")
        private Double duration; // 持续时间（秒）
        
        public TimeRange() {}
        
        public TimeRange(Double startTime, Double endTime) {
            this.startTime = startTime;
            this.endTime = endTime;
            this.duration = endTime - startTime;
        }
        
        public Double getStartTime() { return startTime; }
        public void setStartTime(Double startTime) { this.startTime = startTime; }
        public Double getEndTime() { return endTime; }
        public void setEndTime(Double endTime) { this.endTime = endTime; }
        public Double getDuration() { return duration; }
        public void setDuration(Double duration) { this.duration = duration; }
    }
} 